package cn.fraudmetrix.octopus.modules.mock.controller;

import cn.fraudmetrix.octopus.modules.mock.dao.CrawlTestSceneDao;
import cn.fraudmetrix.octopus.modules.mock.entity.CrawlTestSceneEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author libao.zheng
 * @email libao.zheng@tongdun.cn
 * @date 2018/12/21 09:33
 */
@RestController
@RequestMapping("/mock/crawlTestScene")
public class CrawlTestSceneController {
    @Resource
    private CrawlTestSceneDao CrawlTestSceneDao;
    private final Logger LOGGER = LoggerFactory.getLogger(getClass());

    @PostMapping("/query")
    public List<CrawlTestSceneEntity> query(@RequestBody CrawlTestSceneEntity crawlTestSceneEntity) {
        return CrawlTestSceneDao.select(crawlTestSceneEntity);
    }

    @PostMapping("/add")
    public boolean add(@RequestBody CrawlTestSceneEntity crawlTestSceneEntity) {
        return CrawlTestSceneDao.insert(crawlTestSceneEntity);
    }

    @PostMapping("/update")
    public boolean update(@RequestBody CrawlTestSceneEntity crawlTestSceneEntity) {
        return CrawlTestSceneDao.update(crawlTestSceneEntity);
    }

}
